<script setup lang="ts">
import { ref } from '@vue/reactivity'
const props = defineProps({
    className: {
        type: String,
        defualt: () => { return "默认值" }
    }
})

const emit = defineEmits(['on-change'])

const isShow = ref(false);

const handClick = () => {
    emit('on-change', '子组件的值');
}

const show = () => {
    isShow.value = true;
}

const hide = () => {
    isShow.value = false;
}
 
defineExpose({
    isShow:isShow.value,
    show:show,
    hide:hide
})

</script>

<template>
<div v-show="isShow">
 <div>{{ props.className }}</div>
    <button @click="handClick">点我调用父组件的方法</button>
</div>
</template>